package com.imicode.hotel.utils;

import java.sql.Connection;

import javax.sql.DataSource;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class C3p0Utils {

	private static ComboPooledDataSource dataSource;
	
	static {
		dataSource = new ComboPooledDataSource("c3p0-config");
	}
	
	public static DataSource getDataSource() {
		return dataSource;
	}
	
	public static void main(String[] args) throws Exception {
		Connection conn = C3p0Utils.getDataSource().getConnection();
		System.out.println( conn != null ? "连接数据库成功" : "连接数据库失败");
	}
}
